import daemon
import time

with daemon.DaemonContext():
    f = open('/tmp/a.txt', 'w')
    while True:
        time.sleep(10)
        f.write('hello\n')
        f.flush()
